

public class PacmanBoard {
	
	private char[][] map;
	private Point startLocation;
	private Point finishLocation;
	
	public PacmanBoard(char[][] map) {
		this.map = map;
		initLocations();
	}

	private void initLocations() {
		for(int row = 0; row < map.length; row++) {
			for(int col = 0; col < map[row].length; col++) {
				if(map[row][col] == 'P') {
					startLocation = new Point(row,  col);
				}
				if(map[row][col] == '.') {
					finishLocation = new Point(row, col);
				}
			}
		}
		clear();
	}
	
	private void clear() {
		map[startLocation.getRow()][startLocation.getCol()] = ' ';
		map[finishLocation.getRow()][finishLocation.getCol()] = ' ';
	}
	
	public final char[][] getMap() {
		return map.clone();
	}
	
	public final Point getStartLocation() {
		return startLocation;
	}

	public final Point getFinishLocation() {
		return finishLocation;
	}
	
	public boolean isLocationEmpty(Point location) {
		return map[location.getRow()][location.getCol()] == ' ';
	}
	
}
